import request from "@/request/api";
/* 缺陷工单 */

//查询分页列表
export function getListApi(data) {
  return request({
    url: "/eam-service-order/defect/queryDefectVoList",
    method: "get",
    params: data,
  });
}
//激活缺陷单
export function activeApi(orderId = "") {
  return request({
    url: "/eam-service-order/defect/activePending",
    method: "get",
    params: {
      orderId,
    },
  });
}
//作废缺陷单
export function adeprecateApi(data) {
  return request({
    url: "/eam-service-order/defect/deprecatedBatch",
    method: "delete",
    params: data,
  });
}

//查询分页列表
export function getListNoPageApi(data) {
  return request({
    url: "/eam-service-order/defect/queryList",
    method: "get",
    params: data,
  });
}
//删除（列表多个删除）
export function deleteListApi(data) {
  return request({
    url: "/eam-service-order/defect/deleteList",
    method: "delete",
    params: data,
  });
}
//删除单个工单
export function deleteApi(id = "") {
  return request({
    url: "/eam-service-order/defect/delete",
    method: "delete",
    params: {
      id,
    },
  });
}
//查询单个变更单
export function getDetailsApi(id = "") {
  return request({
    url: "/eam-service-order/defect/queryById",
    method: "get",
    params: {
      id,
    },
  });
}
//查询可提交的人员列表
export function getSubmitUserApi(orderId = "") {
  return request({
    url: "/eam-service-order/defect/execute/querySubmitUserListByOrderId",
    method: "get",
    params: {
      orderId,
    },
  });
}

//新增
export function saveOrUpdate(data) {
  return request({
    url: "/eam-service-order/defect/saveOrUpdate",
    method: "post",
    data: data,
  });
}
//提交工单(没有要保存的信息时)
export function submitApi(data) {
  return request({
    url: "/eam-service-order/defect/submitDefect",
    method: "get",
    params: data,
  });
}
//-------派工信息----------------
//获取派工信息
export function getDispatchApi(data) {
  return request({
    url: "/eam-service-order/dispatch/querySingle",
    method: "get",
    params: data,
  });
}
//保存派工信息
export function saveDispatchApi(data) {
  return request({
    url: "/eam-service-order/dispatch/saveDispatch",
    method: "post",
    data: data,
  });
}
//保存派工信息
export function redeployApi(data) {
  return request({
    url: "/eam-service-order/defect/dispatch/reassign",
    method: "post",
    data: data,
  });
}
//-----------工单执行perform------------
//执行信息列表
export function performListApi(orderId = "") {
  return request({
    url: "/eam-service-order/defectOrderExecute/queryListByOrderId",
    method: "get",
    params: {
      orderId,
    },
  });
}

//新增\保存执行信息
export function performInsertApi(data) {
  return request({
    url: "/eam-service-order/defectOrderExecute/insertOrUpdate",
    method: "post",
    data: data,
  });
}
//查询执行信息详情
export function performDetailsApi(executeId = "") {
  return request({
    url: "/eam-service-order/defectOrderExecute/queryListByOrderExecuteId",
    method: "get",
    params: {
      executeId,
    },
  });
}

//根据工单执行id删除
export function performDeleteApi(executeId = "") {
  return request({
    url: "/eam-service-order/defectOrderExecute/deleteByOrderExecuteId",
    method: "delete",
    params: {
      executeId,
    },
  });
}
//根据工单id删除
export function orderDeletePerform(orderId = "") {
  return request({
    url: "/eam-service-order/defectOrderExecute/deleteByOrderId",
    method: "delete",
    params: {
      orderId,
    },
  });
}

//-----------工单验收------------
//工单验收列表
export function acceptListApi(data) {
  return request({
    url: "/eam-service-order/orderAccept/queryList",
    method: "get",
    params: data,
  });
}
//查询工单验收详情
export function acceptDetailsApi(id = "") {
  return request({
    url: "/eam-service-order/orderAccept/queryById",
    method: "get",
    params: {
      id,
    },
  });
}
//查询工单验收详情
export function acceptDetailsOrder(orderId = "") {
  return request({
    url: "/eam-service-order/orderAccept/queryByOrderId",
    method: "get",
    params: {
      orderId,
    },
  });
}
//新增工单验收
export function acceptInsertApi(data) {
  return request({
    url: "/eam-service-order/orderAccept/insert",
    method: "post",
    data: data,
  });
}

//删除单个工单验收
export function acceptDeleteApi(id = "") {
  return request({
    url: "/eam-service-order/orderAccept/deleteById",
    method: "delete",
    params: {
      id,
    },
  });
}
//更新工单验收
export function acceptUpdateApi(data) {
  return request({
    url: "/eam-service-order/orderAccept/update",
    method: "put",
    data: data,
  });
}

//提交分析报告
export function saveReportApi(data) {
  return request({
    url: "/eam-service-order/defect/orderAccept/saveReportInfo",
    method: "post",
    data: data,
  });
}
//判断缺陷等级是否是一类
export function getDefectLevelApi(level = "") {
  return request({
    url: "/eam-service-configure/defectlevel/getDefectLevelByLevel",
    method: "get",
    params: {
      level,
    },
  });
}

//消缺率统计
export function getRateOfDefect(data) {
  return request({
    url: "/eam-service-order/defect/getRateOfDefect",
    method: "get",
    params: data,
  });
}

//消缺及时率统计
export function getRateImmediateOfDefect(data) {
  return request({
    url: "/eam-service-order/defect/getRateImmediateOfDefect",
    method: "get",
    params: data,
  });
}


//补录备品备件
export function saveExecute(data) {
  return request({
    url: "/eam-service-order/orderExecute/recodePart",
    method: "post",
    data: data,
  });
}